HA$PBExportHeader$w_mcomprobante_param.srw
forward
global type w_mcomprobante_param from window
end type
type ddlb_periodo from ddlb_meses_contabilidad within w_mcomprobante_param
end type
type ddlb_ejercicio from uo_middlb within w_mcomprobante_param
end type
type st_2 from statictext within w_mcomprobante_param
end type
type st_1 from statictext within w_mcomprobante_param
end type
type cb_cancelar from commandbutton within w_mcomprobante_param
end type
type cb_aceptar from commandbutton within w_mcomprobante_param
end type
end forward

global type w_mcomprobante_param from window
integer width = 1509
integer height = 568
boolean titlebar = true
string title = "PARAMETROS CONTABLES"
boolean controlmenu = true
windowtype windowtype = response!
long backcolor = 67108864
string icon = "Structure5!"
boolean center = true
ddlb_periodo ddlb_periodo
ddlb_ejercicio ddlb_ejercicio
st_2 st_2
st_1 st_1
cb_cancelar cb_cancelar
cb_aceptar cb_aceptar
end type
global w_mcomprobante_param w_mcomprobante_param

type variables
datastore ids_datastore
s_parm istr_parm
u_cst_powerdock uo_powerdock
userobject iuo_userObject[]
string is_titulo,is_imagen,is_userobject,isa_alma[],is_alma,isa_tienda[] ,is_tienda
integer ii_tabindex,iia_ejercicio[], iia_periodo[]
boolean ib_Indicador_Cierre = false 
u_cst_grillamaincabedet iuo_grillamain
end variables

on w_mcomprobante_param.create
this.ddlb_periodo=create ddlb_periodo
this.ddlb_ejercicio=create ddlb_ejercicio
this.st_2=create st_2
this.st_1=create st_1
this.cb_cancelar=create cb_cancelar
this.cb_aceptar=create cb_aceptar
this.Control[]={this.ddlb_periodo,&
this.ddlb_ejercicio,&
this.st_2,&
this.st_1,&
this.cb_cancelar,&
this.cb_aceptar}
end on

on w_mcomprobante_param.destroy
destroy(this.ddlb_periodo)
destroy(this.ddlb_ejercicio)
destroy(this.st_2)
destroy(this.st_1)
destroy(this.cb_cancelar)
destroy(this.cb_aceptar)
end on

event open;string ls_dw
string ls_titulo,ls_imagen,ls_userobject,ls_tabtitulo,ls_tipo,ls_window
long ll_count,ll_fila,ll_resul
integer li_window,li_fila,li_tienda

istr_parm = message.powerobjectparm 

for li_fila = 1 to UpperBound(iia_ejercicio[])  
	 if iia_ejercicio[li_fila] = istr_parm.integer_parm[4]  then 
		ddlb_ejercicio.selectitem(li_fila)
		istr_parm.integer_parm[4]=iia_ejercicio[li_fila]
		EXIT 
	end if
next
//
ddlb_periodo.selectitem( month(today()) + 1 )
istr_parm.integer_parm[3]=month(today()) 
//istr_parm.char_parm[1]='0'
//
//
//ids_datastore   = istr_parm.ads_menu //aqui recupera el datastore
//is_userobject 				  = ids_datastore.object.tUserObject[1]
//iuo_grillamain  = istr_parm.auo_grillamaincabedet
//is_titulo 						  = ids_datastore.object.tDesc[1]
//is_imagen  					   = ids_datastore.object.tTabImg[1]
//uo_powerdock = istr_parm.auo_powerdock 
//ls_dw              = ids_datastore.object.tDw1[1]
//
end event

event close;if not ib_Indicador_Cierre then
	ib_Indicador_Cierre = True
	closewithreturn(this,istr_parm)
end if
end event

type ddlb_periodo from ddlb_meses_contabilidad within w_mcomprobante_param
integer x = 507
integer y = 164
integer width = 923
integer taborder = 30
borderstyle borderstyle = stylebox!
end type

event selectionchanged;call super::selectionchanged;integer li_periodo
if index <=0 then return

if index = 1 then 
	li_periodo = 0
else
	li_periodo = index - 1
end if


istr_parm.integer_parm[3] =li_periodo


end event

type ddlb_ejercicio from uo_middlb within w_mcomprobante_param
integer x = 512
integer y = 28
integer width = 928
integer height = 456
integer taborder = 20
end type

event constructor;call super::constructor;event ue_rellena('select idEjercicio,idEjercicio from MEJERCICIO order by 1 asc')
end event

event ue_rellena;long ll_indice= 1
setpointer(hourglass!)

string ls_campo[]
prepare sqlsa from :as_cadena;
declare cur01 dynamic cursor for sqlsa;
open dynamic cur01 ;
fetch cur01 into :iia_ejercicio[1], :is_columna2[1];
do while sqlca.sqlcode=0 
	this.additem(is_columna2[ll_indice])
	ll_indice++
	fetch cur01 into :iia_ejercicio[ll_indice], :is_columna2[ll_indice];
loop
if sqlca.sqlcode = -1 then
   return -1
else
	close cur01 ;
	return 1
end if
setpointer(arrow!)

end event

event selectionchanged;call super::selectionchanged;if index <=0 then return
istr_parm.integer_parm[4] = iia_ejercicio [index]
end event

type st_2 from statictext within w_mcomprobante_param
integer x = 32
integer y = 180
integer width = 475
integer height = 64
integer textsize = -8
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
long backcolor = 67108864
string text = "PERIODO:"
boolean focusrectangle = false
end type

type st_1 from statictext within w_mcomprobante_param
integer x = 32
integer y = 44
integer width = 475
integer height = 64
integer textsize = -8
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
long backcolor = 67108864
string text = "EJERCICIO:"
boolean focusrectangle = false
end type

type cb_cancelar from commandbutton within w_mcomprobante_param
integer x = 791
integer y = 316
integer width = 402
integer height = 112
integer taborder = 20
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
string text = "&Cancelar"
end type

event clicked;closewithreturn(parent,istr_parm)
end event

type cb_aceptar from commandbutton within w_mcomprobante_param
integer x = 343
integer y = 316
integer width = 402
integer height = 112
integer taborder = 10
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
string text = "&Aceptar"
end type

event clicked;long ll_return,ll_alma

ll_return = 0
ll_alma  = long(istr_parm.integer_parm[2] )
//sqlca.Usp_GetUserAlma( gs_iduser,ll_alma, ll_return)
//
//if ll_return = -1 then
//	f_msj('No tiene acceso al almacen seleccionado',4); return
//elseif ll_return = 0  then
//	f_msj('El almacen seleccionado esta desactivado',4); return
//end if

istr_parm.char_parm[1]='1'
//istr_parm.auo_grillamaincabedet = iuo_grillamain
cb_cancelar.event post clicked()

//If istr_parm.string_parm[1]='P' Then
//	iuo_grillamain.Dynamic of_setparm (istr_parm.integer_parm[1],istr_parm.integer_parm[2],istr_parm.integer_parm[3])
//	iuo_grillamain.Dynamic Event  ue_actualizar() 
//	
//End if
//	ii_tabindex ++
//	uo_PowerDock.of_opendocument( iuo_userObject[ii_tabindex],istr_parm,is_titulo ,is_imagen,is_userobject)
//End if
//cb_2.triggerevent( clicked!)
end event

